package org.jeecg.modules.cosmetic.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.cosmetic.handler.ToxicologicalIecicHandler;
import org.jeecg.modules.cosmetic.model.vo.DeleteVO;
import org.jeecg.modules.cosmetic.model.vo.ToxIecicVO;
import org.jeecg.modules.cosmetic.utils.MyValidateUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 毒理数据库IECIC表 前端控制器
 * </p>
 *
 * @author lq
 * @since 2024-05-16 09:45:01
 */
@Api(tags = "毒理数据")
@RestController
@RequestMapping("/api/tox/iecic")
public class TToxicologicalIecicController {

    @Resource
    private ToxicologicalIecicHandler toxicologicalIecicHandler;

    @ApiOperation(value = "新增-更新", notes = "新增-更新")
    @PostMapping(value = "/save_update")
    public Result<?> saveUpdate(@RequestBody ToxIecicVO vo) {
        MyValidateUtil.validThrow(vo);
        return toxicologicalIecicHandler.saveUpdate(vo);
    }

    @ApiOperation(value = "删除数据", notes = "删除数据")
    @DeleteMapping(value = "/delete")
    public Result<?> delete(@RequestBody DeleteVO vo) {
        return Result.ok(toxicologicalIecicHandler.delete(vo.getId()));
    }

}
